package com.mowwang.file;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class BufferedRe {
    public static void main(String[] args) {
        BufferedReader br=null;
        try {

            br=new BufferedReader(new FileReader("c.txt"));
            char[] chars=new char[1024];
            int b;//先是每次读入1024个字符
            while ((b=br.read(chars))!=-1){
                System.out.println(new String(chars,0,b));
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (br!=null) {
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
